<template>
  <div class="common-layout">
    <el-container>
      <el-header style="background-color: bisque; font-size:30px;">用户管理平台
        <span style="float: right;">欢迎{{ data.name}}({{ data.rolename }})</span>
      </el-header>
      <el-container>
        <el-aside width="200px">
             <el-menu
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="el-menu-vertical-demo"
        :default-active="activeIndex"
        :default-openeds="defaultOpeneds"
        text-color="#fff"
       
        router
      >
        <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>用户管理</span>
          </template>
            <el-menu-item index="getuser">用户列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>角色管理</span>
          </template>
            <el-menu-item index="role">角色列表</el-menu-item>
             
        </el-sub-menu>
        <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>菜单管理</span>
          </template>
            <el-menu-item index="getmenu">菜单列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>角色权限管理</span>
          </template>
            <el-menu-item index="getrolemenu">角色权限</el-menu-item>
        </el-sub-menu>


      </el-menu>
        </el-aside>
        <el-main>
            <RouterView/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router=useRouter();
const activeIndex=ref('1');
const defaultOpeneds=ref(['1']);
const data=ref({
  name:'',
  rolename:''
})
onMounted(()=>{
  data.value.name=localStorage.getItem("name")||'';
  data.value.rolename=localStorage.getItem("rolename")||'';
})
</script>
